﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;
using Nova_DAL;
using System.Data.Common;
using Nova_Common;
using System.Data;



public partial class DelStorage_UnDelDataSearch : System.Web.UI.Page
{
    Nova_DAL.DbHelper access = new DbHelper();
    string strSQL = "";
    DbCommand cmd = null;
    DataSet ds = null;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (hidden.Value != "")
        {
            hidden.Value = "";
            bind();
        }

        if (!IsPostBack)
        {
 
        }
    }

    protected void bind()
    {
        strSQL = "SELECT * FROM TBill_DelStorage WHERE 1=1";
        if (txtStorageNo.Text != "")
        {
            strSQL += " AND StockNo = '"+txtStorageNo.Text.ToString()+"'";
        }
        if (txtBTime.Text != "")
        {
            strSQL += " AND CDT >= '"+txtBTime.Text.ToString()+"'";
        }
        if (txtETime.Text != "")
        {
            strSQL += " AND CDT <= '"+txtETime.Text.ToString()+"'";
        }

        //strSQL += " AND SUBSTRING(StockNo,1,2) = 'EB' AND Bill_Status = '0'  ORDER BY CDT DESC";
        strSQL += " AND Bill_Status = '0'  ORDER BY CDT DESC";
        cmd = access.GetSqlStringCommond(strSQL);
        gv.DataSource = access.ExecuteDataSet(cmd);
        gv.DataBind();
    }

    protected void ibtnSearch_Click(object sender, ImageClickEventArgs e)
    {
        bind();
    }
    protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowIndex != -1)
        {
            LinkButton lbtn_StockNo = (LinkButton)e.Row.FindControl("lbtn_StockNo");

            string updateUrl = string.Format("javascript: document.getElementById('{1}').value=window.showModalDialog('UnDelDataList.aspx?Rom="+DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss")+"&strStockNo={0}', window, 'dialogWidth=800px;dialogHeight=500px;scroll:no;resizable:no;status:0;');document.URL=location.href;", lbtn_StockNo.CommandArgument.ToString(), hidden.ClientID);
            lbtn_StockNo.Attributes.Add("onclick", updateUrl);

        }
    }
}
